<div class="campaigns">
    <ol class="breadcrumb" style="font-size: 12px">
        <li>广告计划</li>
        <li>广告主</li>
        <li>广告计划管理</li>
    </ol>

    <div class="panel mb-6">
        <div class="panel-heading panel-style" style="height: 50px">
            <div class="time-search">
                <label class="search-label"></label>
                <div  class="form-inline input-group">
                    <input ims-select-range-time="rangeDate" type="text">
                </div>
            </div>
            <div class="adv-search">
                <label style="float: left;">广告主:</label>
                <div class="input-group input-group-sm" style="padding-left: 3px;s">
                    <select  ng-model="search.advertiserId" class="select-style"  ng-change="advChange()" ng-init="search.advertiserId=search.advertiserId?search.advertiserId:'0'">
                        <option value="0">全部</option>
                        <option value="{{advertiser.id}}" ng-repeat="advertiser in advList">{{advertiser.name}}</option>
                    </select>
                </div>
            </div>
            <div class="plan-search">
                <label  style="float: left;margin-top: 6px">计划:</label>
                <div class="input-group input-group-sm" style="padding-left: 8px">
                    <input type="text" class="form-control" name="keyword" ng-model="search.campaignName" placeholder="搜索">
                    <span class="input-group-btn btn-bearch">
                        <button class="btn btn-default" type="button" ng-click="searchClick(search.campaignName)">
                            <i class="glyphicon glyphicon-search"></i>
                        </button>
                    </span>
                </div>
            </div>
           <div class="search-operation pull-right">
                <a ng-click="add()"  class="btn">
                    <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
                </a>
                <a href="javascript:void(0);" class="btn" ng-click="deleteCampaigns()">
                    <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
                </a>
            </div>
        </div>
    </div>
        <div class="table-responsive" style="margin-top: -20px;">
            <table class="table table-bordered table-hover">
                <thead>
                <tr>
                    <th>选择</th>
                    <th>计划ID</th>
                    <th>计划名称</th>
                    <th>整体预算</th>
                    <th>投放周期</th>
                    <th>预估点击</th>
                    <th>预估曝光</th>
                    <th>创建时间 </th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr  ng-repeat="campaigns in campaignsList.pageList">
                    <td>
                        <input type="checkbox" ng-model="campaigns.checked" class="magic-checkbox" id="{{'campaignsList' + ($index + 1)}}">
                        <label for="{{'campaignsList' + ($index + 1)}}"></label>
                    </td>
                    <td>{{campaigns.campaignId}}</td>
                    <td>{{campaigns.campaignName}}</td>
                    <td>{{campaigns.budget}}</td>
                    <td>{{campaigns.startEndDay}}</td>
                    <td>{{campaigns.expectClick}}</td>
                    <td>{{campaigns.expectShow}}</td>
                    <td>{{campaigns.cTime}}</td>
                    <td> <a href="javascript:void(0);" ng-click="detail(campaigns)">编辑</a>
                    </td>
                </tbody>
            </table>
        </div>
    </div>
    <div class="panel-footer">
        <s-pagination conf="paginationConf"></s-pagination>
    </div>
    <!--<a ui-sref="campaigns.detail({campaignsId:1})"  ui-sref-opts="{inherit:false}">aaaaa</a>-->
</div>
<script type="text/ng-template" id="advManagementAdd.html">
    <div class="modal-header">
        <button type="button" class="close" ng-click="cancel()"><span>&times;</span></button>
        <span class="modal-title">添加广告计划</span>
    </div>
    <div class="modal-body reset-password">
        <div class="control-group text-align-left">
            <label class="control-label form-require w-109">广告主名称</label>
            <div class="controls modal-input">
                <select ng-model="formData.advertiserId" ng-init="formData.advertiserId=formData.advertiserId?formData.advertiserId:''">
                    <option value="">选择</option>
                    <option ng-repeat="adv in advList" value="{{adv.id}}" >{{adv.name}}</option>
                </select>
                <span ng-if="!formData.advertiserId&&submited" class="cl cr"><i class="fa fa-times error" aria-hidden="true"></i>不能为空</span>
            </div>
        </div>
        <div class="control-group text-align-left">
            <label class="control-label form-require w-109">广告计划名称</label>
            <div class="controls modal-input">
                <input type="text" placeholder="计划名称" ng-model="formData.campaignName">
                <span ng-if="!formData.campaignName&&submited" class="cl cr"><i class="fa fa-times error" aria-hidden="true"></i>不能为空</span>
            </div>
        </div>
        <div class="control-group text-align-left" ng-if="mode!='ip'">
            <label class="control-label form-require w-109">整体预算</label>
            <div class="controls modal-input">
                <input type="text"  placeholder="10000" style="width: 100px!important;" ng-model="formData.budget">元
            </div>
        </div>
        <div class="control-group text-align-left">
            <label class="control-label form-require w-109">投放周期</label>
            <div class="controls modal-input"  style="margin-left:-5px;">
                <input ims-select-range-time="rangeDate" type="text">
            </div>
            <span ng-if="!formData.startEndDay&&submited" class="cl cr"><i class="fa fa-times error" aria-hidden="true"></i>不能为空</span>
        </div>
        <div class="control-group text-align-left">
            <label class="control-label form-require w-109">预估曝光</label>
            <div class="controls modal-input">
                <input type="text"  placeholder="1000" ng-model="formData.expectShow">
            </div>
        </div>
        <div class="control-group text-align-left">
            <label class="control-label form-require w-109">预估点击</label>
            <div class="controls modal-input">
                <input type="text" placeholder="1000" ng-model="formData.expectClick">
            </div>
        </div>
    </div>
    <div class="modal-footer">
        <button class="btn btn-primary"click-and-disable="functionThatReturnsPromise()" type="button" ng-click="ok()">{{'确定'}}</button>
        <button class="btn ims-btn" type="button" ng-click="cancel()">{{'取消'}}</button>
    </div>

</script>
<script type="text/ng-template" id="advManagementDetail.html">
    <div class="modal-header">
        <button type="button" class="close" ng-click="cancel()"><span>&times;</span></button>
        <span class="modal-title">编辑广告计划</span>
    </div>
    <div class="modal-body reset-password">
        <div class="control-group text-align-left">
            <label class="control-label form-require w-109">广告计划名称</label>
            <div class="controls modal-input">
                <input type="text" placeholder="计划名称" ng-model="formData.campaignName">
                <span ng-if="!formData.campaignName&&submited" class="cl cr"><i class="fa fa-times error" aria-hidden="true"></i>不能为空</span>
            </div>
        </div>
        <div class="control-group text-align-left" ng-if="mode!='ip'">
            <label class="control-label form-require w-109">整体预算</label>
            <div class="controls modal-input">
                <input type="text"  placeholder="10000" style="width: 100px!important;" ng-model="formData.budget">元
            </div>
        </div>
        <div class="control-group text-align-left">
            <label class="control-label form-require w-109">投放周期</label>
            <div class="controls modal-input" style="margin-left:-5px;">
                <input ims-select-range-time="rangeDate" type="text">
            </div>
            <span ng-if="!$scope.formData.startEndDay!='null~null' && submited" class="cl cr"><i class="fa fa-times error" aria-hidden="true"></i>不能为空</span>

        </div>
        <div class="control-group text-align-left">
            <label class="control-label form-require w-109">预估曝光</label>
            <div class="controls modal-input">
                <input type="text"  placeholder="1000" ng-model="formData.expectShow">
            </div>
        </div>
        <div class="control-group text-align-left">
            <label class="control-label form-require w-109">预估点击</label>
            <div class="controls modal-input">
                <input type="text" placeholder="1000" ng-model="formData.expectClick">
            </div>
        </div>
    </div>
    <div class="modal-footer">
        <button class="btn btn-primary" type="button" ng-click="ok()">{{'确定'}}</button>
        <button class="btn ims-btn" type="button" ng-click="cancel()">{{'取消'}}</button>
    </div>

</script>
